-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
18574 - EFT Verification Fixes #1328
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
.filter(InvoiceModel.payment_method_code == PaymentMethod.EFT.value, | ||
InvoiceModel.overdue_date.isnot(None), | ||
InvoiceModel.overdue_date.cast(Date) <= current_local_time().date(), | ||
func.date(overdue_datetime) <= current_local_time().date(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix timezone issue
auth_account_ids = [pay_account.auth_account_id for _, pay_account in statement_settings | ||
if pay_account.payment_method == PaymentMethod.EFT.value] | ||
|
||
current_app.logger.info(f'Processing {len(auth_account_ids)} EFT accounts for monthly reminders.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some debug, and added some additional filtering for EFT payment method for auth_account_ids
|
||
@classmethod | ||
def find_most_recent_statement(cls, auth_account_id: str, statement_frequency: str) -> StatementModel: | ||
"""Find all payment and invoices specific to a statement.""" | ||
query = db.session.query(StatementModel) \ | ||
.join(PaymentAccountModel, PaymentAccountModel.auth_account_id == auth_account_id) \ | ||
.join(PaymentAccountModel) \ | ||
.filter(PaymentAccountModel.auth_account_id == auth_account_id) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed bad join, missing criteria
.filter(StatementModel.frequency == statement_frequency) \ | ||
.order_by(StatementModel.to_date.desc()) | ||
|
||
return query.first() | ||
|
||
@classmethod | ||
def determine_to_notify_and_is_due(cls): | ||
def determine_to_notify_and_is_due(cls, invoices: [InvoiceModel]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored to be properly driven by overdue date
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1328 +/- ##
==========================================
+ Coverage 91.45% 92.02% +0.56%
==========================================
Files 186 160 -26
Lines 11319 10690 -629
==========================================
- Hits 10352 9837 -515
+ Misses 967 853 -114
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -94,24 +106,24 @@ def publish_statement_notification(pay_account: PaymentAccountModel, statement: | |||
return True | |||
|
|||
|
|||
def publish_payment_notification(pay_account: PaymentAccountModel, statement: StatementModel, | |||
is_due: bool, due_date: datetime, emails: str) -> bool: | |||
def publish_payment_notification(info: StatementNotificationInfo) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converted params to dataclass to make it cleaner
@@ -72,7 +84,7 @@ def publish_statement_notification(pay_account: PaymentAccountModel, statement: | |||
'emailAddresses': emails, | |||
'accountId': pay_account.auth_account_id, | |||
'fromDate': f'{statement.from_date}', | |||
'toDate:': f'{statement.to_date}', | |||
'toDate': f'{statement.to_date}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed typo in params causing failure on the account mailer
@@ -60,6 +60,11 @@ def apply_credit(self, invoice: Invoice) -> None: | |||
self.create_receipt(invoice=invoice_model, payment=payment).save() | |||
self._release_payment(invoice=invoice) | |||
|
|||
def complete_post_invoice(self, invoice: Invoice, invoice_reference: InvoiceReference) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accidentally reverted this change in a previous PR, adding back in.
This allow payments to be properly released for EFT when invoices are created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far
Issue #:
bcgov/entity#18574
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the sbc-pay license (Apache 2.0).